package com.csp.app.service;

import com.baomidou.mybatisplus.plugins.Page;
import com.csp.app.client.ServiceClient;
import com.csp.app.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Service
public class StudentService {
    @Autowired
    private ServiceClient serviceClient;

    /**
     * 添加学生
     *
     * @param student
     * @return
     */
    public boolean add(Student student) {
        return serviceClient.addStudent(student);
    }

    /**
     * 批量添加学生
     *
     * @param students
     * @return
     */
    public boolean batchAdd(List<Student> students) {
        return serviceClient.batchAddStudent(students);
    }

    /**
     * 查询那些学生参加了对应的考试
     *
     * @param examGroupId
     * @return
     */
    public List<Object> selectStudentsByExamGroupId(Integer examGroupId) {
        return serviceClient.selectStudentsByExamGroupId(examGroupId);
    }

    /**
     * 分页查询
     *
     * @param student
     * @param page
     * @param limit
     * @param studentName
     * @param orderFiled
     * @param orderType
     * @return
     */
    public Page<Student> searchSelectivePage(Student student, Integer page, Integer limit, String studentName
            , String orderFiled, String orderType) {
        return serviceClient.searchStudentSelectivePage(student, page, limit, studentName, orderFiled, orderType);
    }
}
